<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="UTF-8" />
        <title>22_案例练习-使用字符来拼接</title>
    </head>
    <body>
        <script>
            // 李小璐|马蓉|白百何|董洁
            var arr = ['李小璐','马蓉','白百何','董洁'];

            var str = '';

            for(var i = 0; i < arr.length-1; i++){
                str += arr[i] + '|';
            }

            str += arr[arr.length-1];

            console.log(str);
        </script>
    </body>
</html>